<?php
// sets a date field to prompt for a date only, without a time of day
// entry format: YYYY-MM-DD
$value = empty($value) ? date('Y-m-d') : $value;
$sql_datetime_column_format = "^(\d\d\d\d-\d\d-\d\d) \d\d:\d\d:\d\d$";
if (preg_match("/$sql_datetime_column_format/", $value, $matches)) {
  if (!empty($matches[1])) {
    $value = $matches[1];
  }
}
?>
<input type="text" class="form date <?php echo $name; ?>" value="<?php echo $value; ?>" />